<html>
<head><meta charset="utf-8"><title>Working on simplier diagnostic · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html">Working on simplier diagnostic</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209165274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209165274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nikita Krupitskas <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209165274">(Sep 05 2020 at 06:59)</a>:</h4>
<p>Hey! Decided to upload intermediate work to ask a couple questions, <a href="https://github.com/rust-lang/rust/pull/76362">https://github.com/rust-lang/rust/pull/76362</a>. Can someone, take a look? :) I've decided to draft pull request for a discussion.</p>



<a name="209175212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209175212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209175212">(Sep 05 2020 at 12:12)</a>:</h4>
<blockquote>
<p>how to understand which ty from this array should I get, i mean borrow problem can be 2nd 3rd.. any argument in array?</p>
</blockquote>
<p>I'd run the check for every argument</p>



<a name="209175350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209175350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209175350">(Sep 05 2020 at 12:16)</a>:</h4>
<blockquote>
<p>As I see, Ty has TyKind and I can be asked is it Rptr, but where to get another Ty to compare it kinds?</p>
</blockquote>
<p>I think this is what <span class="user-mention" data-user-id="119031">@Esteban Küber</span> meant by</p>
<blockquote>
<p>at that point you don't have access to the closure expression, but you get it using self.tcx.hir().get_if_local(found_did.unwrap())</p>
</blockquote>
<p>You should check the actual type against the type expected for the closure.</p>



<a name="209175362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209175362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209175362">(Sep 05 2020 at 12:16)</a>:</h4>
<p>(deleted)</p>



<a name="209422319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209422319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nikita Krupitskas <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209422319">(Sep 08 2020 at 18:00)</a>:</h4>
<p>Okay, I've sit back and did little progress. One another question. So now I have all input variables through</p>
<div class="codehilite"><pre><span></span><code>let found_node = match found_did {
                    Some(found_did) =&gt; self.tcx.hir().get_if_local(found_did),
                    None =&gt; None,
                };
</code></pre></div>


<p>But how to get expected type per input?<br>
I mean I see example: <br>
let expected = expected_ref.skip_binder().substs.type_at(1);<br>
But why we reference type_at(1)?</p>



<a name="209422703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209422703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209422703">(Sep 08 2020 at 18:03)</a>:</h4>
<p>I don't know much about this part of the compiler ... <code>type_at</code> might be <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/type.InternalSubsts.html#method.type_at">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/type.InternalSubsts.html#method.type_at</a> ?</p>



<a name="209422729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209422729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209422729">(Sep 08 2020 at 18:04)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/ty.html">https://rustc-dev-guide.rust-lang.org/ty.html</a> might have more info too</p>



<a name="209423339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209423339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nikita Krupitskas <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209423339">(Sep 08 2020 at 18:10)</a>:</h4>
<p>oof, pretty detailed documentation, big thanks, sounds like I actually need to read it first :D</p>



<a name="209461675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Working%20on%20simplier%20diagnostic/near/209461675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Working.20on.20simplier.20diagnostic.html#209461675">(Sep 09 2020 at 00:53)</a>:</h4>
<p>(side note: you could also check out <a class="stream" data-stream-id="147480" href="/#narrow/stream/147480-t-compiler.2Fwg-diagnostics">#t-compiler/wg-diagnostics</a> and probably ask there as well )</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>